using MediatR;
using S.M.SmartMedical.Domain.DTOs;
using S.M.SmartMedical.ErrorCode;

namespace S.M.SmartMedical.API.Read.Application.Query
{
    /// <summary>
    /// 获取医院列表查询对象
    /// 用于处理医院分页查询请求
    /// </summary>
    public class GetHospitalsQuery : IRequest<APIResult<PageResponse<HospitalDto>>>
    {
        /// <summary>
        /// 医院名称关键字
        /// </summary>
        public string? Name { get; set; }

        /// <summary>
        /// 医院等级
        /// </summary>
        public string? Level { get; set; }

        /// <summary>
        /// 医院类型
        /// </summary>
        public string? Type { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public int CurrentPage { get; set; } = 1;

        /// <summary>
        /// 每页记录数
        /// </summary>
        public int PageSize { get; set; } = 10;

        /// <summary>
        /// 构造函数
        /// </summary>
        public GetHospitalsQuery()
        {
        }

        /// <summary>
        /// 构造函数，从搜索参数DTO初始化
        /// </summary>
        /// <param name="searchParams">搜索参数</param>
        public GetHospitalsQuery(HospitalSearchParamsDto searchParams)
        {
            Name = searchParams.Name;
            Level = searchParams.Level;
            Type = searchParams.Type;
            CurrentPage = searchParams.CurrentPage;
            PageSize = searchParams.PageSize;
        }
    }
}